<?php

namespace app\admin\controller;


use app\common\model\Admin;

class Entry extends Common {

    // 首页
    public function index() {

        // 加载模板文件
        return $this->fetch();
    }

    // 欢迎页面
    public function welcome() {

        $this->assign('phpiniuploadsize',ini_get('upload_max_filesize'));
        $this->assign('bjtime',date('Y年m月d日 H:i:s'));
        return $this->fetch();
    }

    // 修改密码
    public function pass() {

        if (request()->isPost()) {
            $res = (new Admin())->pass(input('post.'));
            if ($res['valid']) {
                //清除session登录信息
                session(null);
                $this->success($res['msg'], 'admin/entry/index');
                exit;
            } else {
                $this->error($res['msg'], null, '', 1);
                exit;
            }
        }
        return $this->fetch();
    }
}
